/**
 * desc: 订单接口
 */

import request from '@/static/uitls/request.js'


// 获取订单列表
const getOrderList = (page,size,status) => {
	return request({
		url: '/api/v1/user.order/index',
		method: 'GET',
		data:{
			page:page,
			size:size,
			status:status
		}
	})
}

// 获取订单详情
const getOrderDetail = (id,showOnload=true) => {
	return request({
		url: '/api/v1/user.order/read?course_order_id='+id,
		method: 'GET',
		showOnload
	})
}


// 申请退款页面(未申请过)
const orderRefund = id => {
	return request({
		url: '/api/v1/refund/order?course_order_id='+id,
		method: 'GET'
	})
}

// 申请退款页面(申请过)
const orderRefundRead = id => {
	return request({
		url: '/api/v1/refund/read?course_refund_id='+id,
		method: 'GET'
	})
}


// 申请退款
const orderRefundCreate = data => {
	return request({
		url: '/api/v1/refund/create',
		method: 'POST',
		data
	})
}

// 取消申请
const orderRefundCancel = id => {
	return request({
		url: '/api/v1/refund/cancel?course_refund_id='+id,
		method: 'GET'
	})
}

// 删除订单
const orderRefundDelete = id => {
	return request({
		url: '/api/v1/user.order/delete?course_order_id='+id,
		method: 'GET'
	})
}


module.exports = {
	getOrderList,
	getOrderDetail,
	orderRefund,
	orderRefundRead,
	orderRefundCreate,
	orderRefundCancel,
	orderRefundDelete
}
